home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / texte / 7up_pd / portab.h < prev    next >
C/C++ Source or Header  |  1998-10-29  |  10KB  |  231 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /* PORTAB.H                                                                  */
  4. /*                                                                           */
  5. /* Use of this file may make your code compatible with all C compilers       */
  6. /* listed.                                                                   */
  7. /*                                                                           */
  8. /*****************************************************************************/
  9.  
  10. /*****************************************************************************/
  11. /* ENVIRONMENT                                                               */
  12. /*****************************************************************************/
  13.  
  14. #if !defined( __PORTAB__ )
  15. #define __PORTAB__
  16.  
  17. #define GEMDOS     1                          /* Digital Research GEMDOS     */
  18. #define MSDOS      0                          /* Microsoft MSDOS             */
  19. #define OS2        0                          /* Microsoft OS/2              */
  20. #define FLEXOS     0                          /* Digital Research FlexOS     */
  21.  
  22. #define MiNT       1                          /* Atari MultiTOS */
  23.  
  24. #define M68000     1                          /* Motorola Processing Unit    */
  25. #define I8086      0                          /* Intel Processing Unit       */
  26.  
  27. #define DR_C       0                          /* Digital Research C Compiler */
  28. #define LASER_C    0                          /* Laser C Compiler            */
  29. #define LATTICE_C  0                          /* Lattice C Compiler          */
  30. #define MW_C       0                          /* Mark Williams C Compiler    */
  31. #define TURBO_C    1                          /* Turbo C Compiler            */
  32. #define MS_C       0                          /* Microsoft C Compiler        */
  33. #define HIGH_C     0                          /* Metaware High C Compiler    */
  34.  
  35. #define GEM1       0x0001                     /* ATARI GEM version           */
  36. #define GEM2       0x0002                     /* MSDOS GEM 2.x versions      */
  37. #define GEM3       0x0004                     /* MSDOS GEM/3 version         */
  38. #define XGEM       0x0100                     /* OS/2,FlexOS X/GEM version   */
  39.  
  40. #ifndef GEM
  41. #if GEMDOS
  42. #define GEM        GEM1                       /* GEMDOS default is GEM1      */
  43. #endif /* GEMDOS */
  44.  
  45. #if MSDOS
  46. #define GEM        GEM3                       /* MSDOS default is GEM3       */
  47. #endif /* MSDOS */
  48.  
  49. #if OS2
  50. #define GEM        XGEM                       /* OS/2 default is X/GEM       */
  51. #endif /* MSDOS */
  52.  
  53. #if FLEXOS
  54. #define GEM        XGEM                       /* FlexOS default is X/GEM     */
  55. #endif /* FLEXOS */
  56. #endif /* GEM */
  57.  
  58. /*****************************************************************************/
  59. /* STANDARD TYPE DEFINITIONS                                                 */
  60. /*****************************************************************************/
  61.  
  62. #define BYTE    char                          /* Signed byte                 */
  63. #define UBYTE   unsigned char                 /* Unsigned byte               */
  64.  
  65. #if LATTICE_C
  66. #define WORD    short                         /* Signed word (16 bits)       */
  67. #define UWORD   unsigned short                /* unsigned word               */
  68. #else
  69. #define WORD    int                           /* Signed word (16 bits)       */
  70. #define UWORD   unsigned int                  /* unsigned word               */
  71. #endif
  72.  
  73. #define LONG    long                          /* signed long (32 bits)       */
  74. #define ULONG   unsigned long                 /* Unsigned long               */
  75.  
  76. #define BOOLEAN WORD                          /* 2 valued (true/false)       */
  77.  
  78. #define FLOAT   float                         /* single precision float      */
  79. #define DOUBLE  double                        /* double precision float      */
  80.  
  81. #define INT     int                           /* a machine dependent int     */
  82. #define UINT    unsigned int                  /* a machine dependent uint    */
  83.  
  84. #define REG     register                      /* register variable           */
  85. #define AUTO    auto                          /* Local to function           */
  86. #define EXTERN  extern                        /* External variable           */
  87. #define LOCAL   static                        /* Local to module             */
  88. #define MLOCAL  LOCAL                         /* Local to module             */
  89. #define GLOBAL                                /* Global variable             */
  90.  
  91. /*****************************************************************************/
  92. /* COMPILER DEPENDENT DEFINITIONS                                            */
  93. /*****************************************************************************/
  94.  
  95. #if GEMDOS                                    /* GEMDOS compilers            */
  96. #if DR_C
  97. #define void WORD                             /* DR_C doesn't know void      */
  98. #endif /* DR_C */
  99.  
  100. #if LASER_C
  101. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  102. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  103. #endif /* LASER_C */
  104.  
  105. #if LATTICE_C
  106. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  107. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  108. #endif /* LATTICE_C */
  109.  
  110. #if TURBO_C
  111. #define graf_mbox graf_movebox                /* Wrong GEM binding           */
  112. #define graf_rubbox graf_rubberbox            /* Wrong GEM binding           */
  113. #endif /* TURBO_C */
  114.  
  115. #if MW_C
  116. #define VOID WORD                             /* MW_C doesn't know (void *)  */
  117. #endif /* MW_C */
  118.  
  119. #if LATTICE_C
  120. #define ADR(A) (LONG)A >> 16, (LONG)A & 0xFFFF
  121. #else
  122. #define ADR(A) (WORD)((LONG)A >> 16), (WORD)((LONG)A & 0xFFFF)
  123. #endif /* LATTICE_C */
  124. #endif /* GEMDOS */
  125.  
  126. #if MSDOS | OS2                               /* MSDOS or OS2 compilers      */
  127. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  128. #endif /* MSDOS */
  129.  
  130. #if FLEXOS                                    /* FlexOS compilers            */
  131. #define ADR(A) (WORD)((LONG)A & 0xFFFF), (WORD)((LONG)A >> 16)
  132. #endif /* FLEXOS */
  133.  
  134. #if MS_C | TURBO_C | HIGH_C                   /* ANSI compilers              */
  135. #define ANSI 1
  136. #define _(params) params                      /* parameter checking          */
  137. #else
  138. #define ANSI 0
  139. #define _(params) ()                          /* no parameter checking       */
  140. #define const
  141. #define volatile
  142. #define size_t UINT
  143. #endif
  144.  
  145. #if DR_C | LASER_C | LATTICE_C | MW_C | HIGH_C
  146. #define cdecl
  147. #define pascal
  148. #endif
  149.  
  150. #define CONST    const
  151. #define VOLATILE volatile
  152. #define CDECL    cdecl
  153. #define PASCAL   pascal
  154.  
  155. #define SIZE_T   size_t
  156.  
  157. #ifndef VOID
  158. #define VOID     void
  159. #endif
  160.  
  161. /*****************************************************************************/
  162. /* OPERATING SYSTEM DEPENDENT DEFINITIONS                                    */
  163. /*****************************************************************************/
  164.  
  165. #if GEMDOS
  166. #define FAR                                   /* Far Pointer                 */
  167. #define NEAR                                  /* Near Pointer                */
  168. #else
  169. #define FAR     far                           /* Far Pointer                 */
  170. #define NEAR    near                          /* Near Pointer                */
  171. #endif /* GEMDOS */
  172.  
  173. #if GEM & GEM1
  174. #define appl_bvset(bvdisk, bvhard)
  175. /*
  176. #define appl_yield() evnt_timer (0, 0)
  177. */
  178. #define menu_unregister(mid)
  179. /*
  180. #define scrp_clear()
  181. */
  182. #define xgrf_stepcalc(orgw, orgh, xc, yc, w, h, pcx, pcy, pcnt, pxstep, pystep)
  183. #define xgrf_2box(xc, yc, w, h, corners, cnt, xstep, ystep, doubled)
  184. #endif /* GEM1 */
  185.  
  186. #if GEM & (GEM1 | XGEM)
  187. #define shel_rdef(lpcmd, lpdir)
  188. #define shel_wdef(lpcmd, lpdir)
  189. #endif /* GEM1 | XGEM */
  190.  
  191. #if GEM & (GEM1 | GEM2)
  192. #define menu_click(click, setit)
  193. #define v_copies(handle, count)
  194. #define v_etext(handle, x, y, string, offsets)
  195. #define v_orient(handle, orientation)
  196. #define v_tray(handle, tray)
  197. #define v_xbit_image(handle, filename, aspect, x_scale, y_scale, h_align, v_align, rotate, background, foreground, xy)\
  198.         v_bit_image (handle, filename, aspect, x_scale, y_scale, h_align, v_align, xy)
  199. #define vst_ex_load_fonts(handle, select, font_max, font_free)\
  200.         vst_load_fonts   (handle, select)
  201. #endif /* GEM1 | GEM2 */
  202.  
  203. #if GEM & (GEM2 | GEM3 | XGEM)
  204. #define fsel_exinput(pipath, pisel, pbutton, plabel)\
  205.         fsel_input  (pipath, pisel, pbutton)
  206. #define wind_new()
  207. #endif /* GEM2 | GEM3 | XGEM */
  208.  
  209. /*****************************************************************************/
  210. /* MISCELLANEOUS DEFINITIONS                                                 */
  211. /*****************************************************************************/
  212.  
  213. #define FALSE   (BOOLEAN)0                    /* Function FALSE value        */
  214. #define TRUE    (BOOLEAN)1                    /* Function TRUE  value        */
  215. #define FAILURE (-1)                          /* Function failure return val */
  216. #define SUCCESS 0                             /* Function success return val */
  217. #define FOREVER for (;;)                      /* Infinite loop declaration   */
  218. #define EOS     '\0'                          /* End of string value         */
  219. /*
  220. #ifndef NULL
  221. #define NULL    0L                            /* Null long value             */
  222. #endif
  223. */
  224. #ifndef EOF
  225. #define EOF     (-1)                          /* EOF value                   */
  226. #endif
  227. #define min(a,b) ((a)<(b)?(a):(b))
  228. #define max(a,b) ((a)>(b)?(a):(b))
  229. #endif /* __PORTAB__ */
  230.  
  231.